﻿using System;
using System.Collections.Generic;
using System.Text;
using Mesuro.Equation.Libraries;

namespace Mesuro.Equation {
	public class CREATE {
		static void Main( string[] args ) {
			ConsoleCalculator();
			Console.WriteLine( "Press any key to continue..." );
			Console.ReadKey( true );
		}
		static void ConsoleCalculator() {
			LibTrigonometry.Load();
			LibTeX.Load();
			EqScope.Intrinsic.CreateSymbol( "\u03C0", new EqRealConstant( 3.1415926535897932 ), EqSymbolFlags.WriteProtect | EqSymbolFlags.Permanent );
			String exp;
			Console.Write( "> " );
			while ((exp = Console.ReadLine()) != "") {
				try {
					Console.WriteLine( "  " + EqParser.Evaluate( exp ) );
				} catch (ExpressionException ex) {
					Console.WriteLine( ex.Message );
				}
				Console.Write( "> " );
			}
		}
	}
}
